% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ejscreenapi1.R
\name{ejscreenapi1}
\alias{ejscreenapi1}
\title{Use EJScreen API to get stats on ONLY ONE circular buffer}
\usage{
ejscreenapi1(
  lon,
  lat,
  radius = 3,
  unit = "miles",
  wkid = 4326,
  fips = NULL,
  shapefile = NULL,
  namestr = "",
  format_report_or_json = "pjson",
  ipurl = "ejscreen.epa.gov",
  getstatefromplacename = TRUE
)
}
\arguments{
\item{lon}{Longitude numeric}

\item{lat}{Latitude numeric}

\item{radius}{radius, in miles, of circular buffer}

\item{unit}{miles (default) or kilometers}

\item{wkid}{optional spatial reference code. https://epsg.io/4326}

\item{fips}{if used instead of lon,lat it should be a character FIPS code
(counties, tracts, or blockgroups)}

\item{shapefile}{not implemented}

\item{namestr}{optional text used on report if fips provided and you want to show this text instead of the FIPS code on the report}

\item{format_report_or_json}{default is "pjson" but could "report" to get URL for a pdf report}

\item{ipurl}{IP or URL start}

\item{getstatefromplacename}{set to FALSE if you need the exact output of API and
TRUE if you want to try to extract ST abbrev and statename from the placename field,
which is more likely to be correct than the stateAbbr and stateName fields in the API output.}
}
\description{
Get EJScreen report results for one circular buffer, as a data.frame
}
\details{
Specify a radius and vector of latitude longitude points,
and get for a buffer the population weighted mean value of each raw indicator
like percent low-income, and total population count, and percentiles for those
raw indicator scores, all from EJScreen, as in an EJScreen standard report.

Note that this API is fairly slow, so it is fine for 10 sites, but not large numbers.

Relies on \code{\link[=ejscreenRESTbroker]{ejscreenRESTbroker()}} for the actual request via API,
and \code{\link[=ejscreenRESTbroker2table]{ejscreenRESTbroker2table()}} to format it and handle errors.

It essentially does this: ejscreenRESTbroker2table(ejscreenRESTbroker())
And then it adds the columns  "pdf_report" and "pdf_acs_report"

It returns a 1-row data.frame

and makes relevant columns values numeric,
and converts text like 45\% to the number 45.

It also drops redundant columns where the same numbers had been returned from API
using the normal name and a synonym name, as with TOTALPOP and "totalPop"

See  (https://www.epa.gov/ejscreen/ejscreen-api)
}
\examples{
 
 \dontrun{
 # Specify size of buffer circle and pick random points as example data
 myradius <- 1
 pts <- structure(list(lon = c(-96.4798957, -111.7674343, -75.4173589, 
 -95.9573172, -87.8402677, -77.9996191, -73.920702, -79.9545638, 
 -76.0638877, -114.9881473), lat = c(31.782716, 33.7522735, 39.8697972, 
 33.2522474, 41.9763992, 38.4661259, 41.2940801, 32.8099327, 40.9888266, 
 36.0043628), id = 1:10), row.names = c(NA, -10L), class = "data.frame")
 out1 <- ejscreenapi1(lon = pts$lon[1], lat=pts$lat[1], radius = myradius)
 t(out1)
 #out <- ejscreenapi(lon=pts$lon, lat=pts$lat, radius = myradius)
 #t(out[1:2,])
 }
 
}
\seealso{
\code{\link[=ejscreenit]{ejscreenit()}} \code{\link[=ejscreenapi_plus]{ejscreenapi_plus()}} \code{\link[=ejscreenapi]{ejscreenapi()}}
that uses \code{\link[=ejscreenapi1]{ejscreenapi1()}} and \code{\link[=ejscreenRESTbroker]{ejscreenRESTbroker()}}  and \code{\link[=ejscreenRESTbroker2table]{ejscreenRESTbroker2table()}}
}
\keyword{internal}
